package com.app.controller;

import org.apache.logging.log4j.Logger;

import com.app.annotation.UrlMapper;
import com.app.conf.AppConfig;
import com.jfinal.core.Controller;

@UrlMapper(val="/kafka")
public class KafkaController extends Controller
{
	private Logger logger = AppConfig.getAppConfig().getLogger();
	
	public void index()
	{
		renderText("KafkaController->IndexAction");
	}
	
	/**
	 * 发送队列消息
	 * **/
	public void send()throws Exception
	{
		String topic   = this.getPara("topic","none");
		String message = this.getPara("message","{}");
		
		logger.info(topic+"#"+message);
		
		AppConfig.getAppConfig().getKafkaProducter().send(topic, message);
		
		renderText("SUCCESS");
	}
	
}